package edu.ccut.titan.tag.chart.render;


import org.jfree.chart.renderer.category.BarRenderer;

import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: Leslie
 * Date: 2005-11-14
 * Time: 21:58:51
 * Descriptions:
 */
public class CustomRenderer  extends BarRenderer {
	
	private static final long serialVersionUID = -2071296883514608946L;
	
	/** The colors. */
    private Paint[] colors;

    /**
     * Creates a new renderer.
     *
     * @param colors  the colors.
     */
    public CustomRenderer(Paint[] colors) {
        this.colors = colors;
    }

    /**
     * Returns the paint for an item.  Overrides the default behaviour inherited from
     * AbstractRenderer.
     *
     * @param row  the series.
     * @param column  the category.
     *
     * @return The item color.
     */
    public Paint getItemPaint(int row, int column) {
        return colors[column % colors.length];
    }

}
